package com.meisiabc.app.repository.db.manager;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.meisiabc.app.repository.db.entity.CurriculumSchedule;
import com.meisiabc.app.repository.db.entity.FreeAudition;
import com.meisiabc.app.repository.db.entity.Trylistenmanage;
import com.meisiabc.app.repository.db.mapper.TrylistenmanageMapper;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class TrylistenmanageManager extends ServiceImpl<TrylistenmanageMapper, Trylistenmanage> {
    public List<Trylistenmanage> selectByStudentId(String studentId) {
        return list(new QueryWrapper<Trylistenmanage>().eq("student_id", studentId));
    }

    public List<Trylistenmanage> selectAuditionTime() {
        return list(new QueryWrapper<Trylistenmanage>().isNotNull("audition_time"));
    }

    public List<Trylistenmanage> selectList(String date) {
        return list(new QueryWrapper<Trylistenmanage>().isNotNull("teacher_id").isNotNull("audition_time").eq("isdeleted", "0")
                .ge("audition_date", date).ne("now_state","已完成"));
    }

    public void updateVedio(Integer id,String video){
        update(Trylistenmanage.builder().video(video).build(), new QueryWrapper<Trylistenmanage>().eq("id", id));
    }
}
